<?php 

// 发头部
header("Content-type: image/png");
//创建画布
$src = imageCreateTrueColor(400,200); 
// 选颜色
$color = imageColorAllocate($src,163,73,164); 

//填充
imageFill($src,0,0,$color);


$src = imageCreateFrompng('./bg.png');  

for ($i=0; $i <10 ; $i++) { 
	$color = imageColorAllocate($src,mt_rand(150,255),mt_rand(150,255),mt_rand(150,255)); 

	// imagefilledrectangle ( $src , mt_rand(0,400) , mt_rand(0,200) , mt_rand(0,400)  , mt_rand(0,200), $color );

	imagerectangle ( $src , mt_rand(0,400) , mt_rand(0,200) , mt_rand(0,400)  , mt_rand(0,200), $color );
}

// imageellipse ( $src, 200 ,100 , 200 , 100 ,$color);

// imagefilledellipse( $src, 200 ,100 , 200 , 100 ,$color);

// imageline ( $src , int $x1 , int $y1 , int $x2 , int $y2 , $color );


// for ($i=0; $i <100 ; $i++) { 
// 	$color = imageColorAllocate($src,mt_rand(150,255),mt_rand(150,255),mt_rand(150,255)); 

// 	// imageline ( $src , mt_rand(0,400) , mt_rand(0,200) , mt_rand(0,400)  , mt_rand(0,200), $color );

// 	imagesetpixel ( $src , mt_rand(0,400), mt_rand(0,200) ,$color );
// }


for ($i=0; $i < 2; $i++) { 

	$str = "qwertyuiopasdfghjklzxcvbnm1234567890QWERTYUIOPASDFGHJKLZXCVBNM";

	$word = $str[mt_rand(0,strlen($str)-1)];

	$color = imageColorAllocate($src,mt_rand(150,255),mt_rand(150,255),mt_rand(150,255));

	$diff = 400/2;

	$width = ($diff-80)/2+$diff*$i;

	imagettftext ( $src , 80 ,mt_rand(-15,15) , $width , 140 , $color , './CharlemagneStd-Bold.otf' , $word);
}




// 输出图片
imagepng($src);  


imageDestroy($src);







 ?>